Skip to content

Conversation

@garthlei
Copy link
Contributor

The index == 0 scenerio has already been handled by the early return, so only the upper half scenerio is relevant here.

The index == 0 scenerio has already been handled by the early return,
so only the upper half scenerio is relevant here.
@llvmbot
Copy link
Member

llvmbot commented Nov 17, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Garth Lei (garthlei)

Changes

The index == 0 scenerio has already been handled by the early return, so only the upper half scenerio is relevant here.


Full diff: https://github.com/llvm/llvm-project/pull/168313.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+1-1)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 38cce26e44af4..c6eb0e929f93d 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -2539,7 +2539,7 @@ bool RISCVTargetLowering::isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
   // TODO: For sizes which aren't multiples of VLEN sizes, this may not be
   // a cheap extract.  However, this case is important in practice for
   // shuffled extracts of longer vectors.  How resolve?
-  return (ResElts * 2) == SrcElts && (Index == 0 || Index == ResElts);
+  return (ResElts * 2) == SrcElts && Index == ResElts;
 }
 
 MVT RISCVTargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context,

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@garthlei
Copy link
Contributor Author

@topperc Could you merge it for me?

@lukel97 lukel97 merged commit ea26d92 into llvm:main Nov 18, 2025
12 checks passed
@garthlei garthlei deleted the 20251117-rvcost-nfc branch November 18, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants